from PyQt4 import QtCore

class FilterObject(QtCore.QObject):
    def eventFilter(self, obj, event):
        if event.type() == QtCore.QEvent.MouseButtonPress:
            traceback.print_exc()
        else:
            print event.type()
        #Pass the event onto the parent window.
        return QtCore.QObject.eventFilter(self, obj, event)